<?php
namespace app\admin\controller;

use app\common\model\RegisterAct as RegisterActModel;
use think\Request;
use think\Session;
use app\common\model\ViewBlock;

class RegisterAct extends Base
{
	protected $page_tag='reg';
	protected $page_desc='大赛报名记录明细查看';
	protected $page_title='报名管理';
	
	protected $sub_menu=[
		'index'=>[
			'title'=>'报名列表',
			'url'=>"/admin/register_act/index"
		]
	];
	public function index()
    {
	    $data['modify_url']=url("/admin/register_act/modifyReg");
	    $vb=new RegisterActModel();
	    $condition=[];
	    $data['group']=input('group');
	    $data['has_per']=input('has_per');
	    $data['name']=input('name');
	    $data['phone']=input('phone');
	    
	    $data['name'] && $condition['name']=['like',"%".$data['name']."%"];
	    $data['group'] && $condition['group']=$data['group'];
	    $data['phone'] && $condition['phone']=$data['phone'];
	    $data['has_per'] !==''  && $data['has_per']!==null && $condition['has_per']=$data['has_per'];
	    $view=new ViewBlock();
	    $data['group_list']=$view->getContentByPosition("zubie")['content'];
	    $data['list']=$vb->getList($condition);
    	return $this->fetch('',$data);
    }
    
    public function modifyReg(){
		$this->layout='layout_empty';
	    $data['submit_url']=url("/api/register_act/modifyReg");
	    if(input('id')){
	    	$vb=new RegisterActModel();
	    	$data['info']=$vb->getInfo(['id'=>input('id')]);
	    }
	    $view=new ViewBlock();
	    $data['group_list']=$view->getContentByPosition("zubie")['content'];
	    return $this->fetch('',$data);
    }
	
}
